<?php
namespace app\admin\validate;
use think\Validate;

/**
 * 用户管理员验证
 * User: Administrator
 * Date: 2017/10/28
 * Time: 14:03
 */
class Admin extends Validate
{
    protected $rule = [
        'username' => 'require|max:15|unique:user',
        'password' => 'require',
    ];
    protected $message = [
        'username.require' => '管理员名称必须填',
        'username.max' => '管理员名称最多不能超过15个字符',
        'username.unique' => '管理员名称不得重复',
        'password.require' => '密码必须填',
    ];
    protected $scene =[
        'add' =>['username','password'],
        'edit' =>['username']
    ];
}